/**
 * 离职管理接口
 */
import request from '@/utils/request';
import { stringify } from 'qs';
/**
 * 获取离职列表
 * @param {object} params
 */
export async function queryLeaveList(params) {
    return request('/api/dimission/v1/order/findPage', {
        method: 'POST',
        data: params
    });
}
/**
 * 获取已离职列表
 * @param {object} params
 */
export async function queryHistoryLeaveList(params) {
    return request('/api/dimission/v1/order/history/findPage', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取用户个人资料
 * @param {Object} params
 * @param {string} params.employeeCode
 * @returns {Object}
 */
export async function getEmployeeProfile(params) {
    return request('/api/uc/employee/manage/v1/queryEmployeeArchiveHead4LeaveJob', {
        method: 'POST',
        data: params
    });
}
/**
 *获取交接内容
 * @param
 * @returns
 */
export async function getHandoverContent(params) {
    return request('/api/dimission/v1/matter/progress', {
        method: 'POST',
        data: params
    });
}
/**
 *获取工作安排--系统待办列表
 * @param {Object} params
 * @returns {Object}
 */
export async function getSystemTodoList(params, employeeCode) {
    return request(`/api/messagecenter/taskpool/v1/tasks/${employeeCode}`, {
        method: 'POST',
        data: params
    });
}
/**
 *完成交接
 * @param {Object} params
 * @returns {Object}
 */
export async function completeHandover(params) {
    return request('/api/dimission/v1/matter/complete', {
        method: 'POST',
        data: params
    });
}
/**
 *离职引导/交接详情--根据离职单Id
 * @param {integer} dimissionOrderId
 * @returns
 */
export async function getHandoverDetailByOrderId(dimissionOrderId) {
    return request(`/api/dimission/v1/matter/all/${dimissionOrderId}`, {
        method: 'GET'
    });
}
/**
 *查询同事
 * @param params
 * @returns
 */
export async function getColleague(params) {
    return request('/api/org/v2/functional/queryColleague', {
        method: 'POST',
        data: params
    });
}
/**
 *修改离职交接的处理人
 * @param params
 * @returns
 */
export async function changeHandoverDeal(params) {
    return request('/api/dimission/v1/order/update/handover/deal', {
        method: 'POST',
        data: params
    });
}
/**
 *
 * @param {integer} id
 * @returns
 */
export async function getHandoverDetailByHandoverId(id) {
    return request(`/api/dimission/v1/matter/${id}`, {
        method: 'GET'
    });
}

// 获取解除劳动关系配置信息
export function getSeverSetting() {
    return request('/api/dimission/v1/settings/labors', {
        method: 'GET'
    });
}
/**
 * 根据公司编码获取假期字典
 * {companyCode: "ORG15540490989436999"}
 */
export async function getLeaveTypeListByCondition(params) {
    return request('/api/oa/v1/leavetype/leavetypelistbycondition', {
        method: 'POST',
        data: params
    });
}
/**
 *获取假期列表
 * @param {*} params
 * @returns
 * companyCode: "ORG15540490989436999"
 * departmentCode: undefined(可选)
 * employeeCodes: []
 * pageNo: 1
 * pageSize: 10
 */
export async function queryVocationList(params) {
    // return request('/api/oa/v1/vocation/getlist', {
    // 根据处理人考勤模块的数据权限做关联，需要放开,所以替换接口
    return request('/api/oa/v1/vocation/getEmployeeVocationList', {
        method: 'POST',
        data: params
    });
}
/**
 * 获取假期类型列表
 */
export function getColumnlist(companyCode) {
    // return request(`/api/oa/v1/leavetype/columnlist/${companyCode}`, {
    return request(`/api/work/v1/attendance/leavetype/typelist/${companyCode}`, {
        method: 'POST'
    });
}
/**
 *查询离职算薪生成的工资单
 * @param {*} params
 * @returns
 * organizationCode: ""
 * employeeCode: ""
 */
export async function getLeavePayroll(params) {
    return request('/api/finance/salary/v1/salaryPayroll/getLeavePayroll', {
        method: 'POST',
        data: params
    });
}
/**
 *离职人员生成工资单
 * @param {*} params
 * @returns
 * kpiList: [{ employeeCode: "" }]
 */
export async function generateLeavePayroll(params) {
    return request('/api/finance/salary/v1/salaryPayroll/generateLeavePayroll', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取面谈准备
 * @param {string} interviewArrangeId
 */
export async function getTalKPrepare(interviewArrangeId) {
    return request(`/api/dimission/v1/interviews/prepare/getInterviewPrepareInfo/${interviewArrangeId}`, {
        method: 'GET'
    });
}

/**
 * 提交面谈准备
 * @param {object} params
 */
export async function handleSubmitTalKPrepare(params) {
    return request('/api/dimission/v1/interviews/prepare/batchCreateOrUpdateInterview', {
        method: 'POST',
        data: params
    });
}

/**
 * 更改面谈过程的录音操作状态
 */
export function changeTalkAudioRecordState(params) {
    return request('/api/interview/v1/voice/actions/temp/save_interview_voice_record_state', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取面谈当前面试录音状态
 */
export function getTalkAudioRecordState(data) {
    return request(`/api/interview/v1/voice/temp/interview_voice_record_state?${stringify(data)}`, {
        method: 'GET'
    });
}

/**
 * 获取面谈记录数据
 */
export function getTalkProcedure(interviewArrangeId) {
    return request(`/api/interview/v1/question/all/question/${interviewArrangeId}`, {
        method: 'GET'
    });
}

/**
 * 重置面试过程的录音操作状态-临时接口
 */
export async function resetTalkRecordState(arrangeId) {
    return request('/api/interview/v1/voice/actions/temp/reset_interview_voice_record_state', {
        method: 'POST',
        data: { arrangeId, recordState: 2 }
    });
}

/**
 * 保存面谈过程信息
 */
export async function onSaveTalkProcedure(params) {
    return request('/api/dimission/v1/interviews/record/proposal/create', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈记录-保存/更新面谈问题名称
 * @param {*} params
 */
export function saveQuestion(params) {
    return request('/api/interview/v1/procedure/createOrUpdate', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈记录-删除面谈问题
 * @param {*} questionId
 */
export async function deleteQuestion(questionId) {
    return request(`/api/interview/v1/procedure/${questionId}`, {
        method: 'DELETE'
    });
}

/**
 * 面谈记录-保存/更新面谈记录的答复
 * @param {*} params
 */
export function saveAnswer(params) {
    return request('/api/interview/v1/procedure/answer/createOrUpdate', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈记录--保存/更新面谈记录的问题评论
 * @param {*} params
 */
export function saveComment(params) {
    return request('/api/interview/v1/procedure/comment/createOrUpdate', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈记录--面谈问题交换排序
 */
export async function changeQuestionsOrder(params) {
    return request('/api/interview/v1/procedure/update/seq', {
        method: 'POST',
        data: params
    });
}

// 获取未开始面谈官员工名称
export function getUnStartInterviewer(arrangeId) {
    return request(`/api/interview/v1/voice/${arrangeId}/no_start_interviewer`, {
        method: 'GET'
    });
}

// 同步当前用户访问页面状态
export function syncInterviewStatus(data) {
    return request('/api/interview/v1/voice/actions/start_interview_record', {
        method: 'POST',
        data
    });
}

// 获取当前在录音的员工
export function getInterviewRecordStatus(arrangeId) {
    return request(`/api/interview/v1/voice/${arrangeId}/start_interview_voice_operate_employee`, {
        method: 'GET'
    });
}

// 获取当前面试官信息
export function getInterviewerDetail(arrangeId) {
    return request(`/api/interview/v1/record/getCurrentInterviewAbsentRecord/${arrangeId}`, {
        method: 'GET'
    });
}

// 获取面谈详情
export function getTalkDetail(arrangeId) {
    return request(`/api/dimission/v1/interviews/${arrangeId}`, {
        method: 'GET'
    });
}

/**
 * 面谈总结-获取总结信息
 */
export function getConclusion(arrangeId, dimissionCode) {
    return request(
        `/api/dimission/v1/interviews/record/getSummaryInfo?arrangeId=${arrangeId}&dimissionCode=${dimissionCode}`,
        {
            method: 'GET'
        }
    );
}

/**
 * 面谈总结-创建IM
 */
export function createImGroup(params) {
    return request('/api/interview/v1/im/create', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈总结-校验是否所有面试官都提交了面试记录
 */
export function getConclusionSubmitStatus(arrangeId) {
    return request(`/api/interview/v1/record/validateRecords/${arrangeId}`, {
        method: 'GET'
    });
}

/**
 * 面谈总结-获取未提交面试过程的面试官
 */
export function getUnSubmitInterviewProcedure(arrangeId) {
    return request(`/api/interview/v1/record/list/unSubmitInterviewProcedure/${arrangeId}`, {
        method: 'GET'
    });
}

/**
 * 面谈总结-获取未提交面试过程的面试官
 */
export function setInterviewAbsent(params) {
    return request('/api/interview/v1/record/set/absent', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈总结-面谈缺席提醒（提醒面谈官）
 */
export function notifyInterview(params) {
    return request('/api/interview/v1/record/absent/remind', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈总结-面谈缺席提醒（提醒面谈官）
 */
export function cancelInterviewAbsent(params) {
    return request('/api/interview/v1/record/cancel/absent', {
        method: 'POST',
        data: params
    });
}

/**
 * 面谈总结-面谈缺席提醒（提醒面谈官）
 */
export function submitConclusion(params) {
    return request('/api/dimission/v1/interviews/record/createInterviewSummary', {
        method: 'POST',
        data: params
    });
}

// 创建或修改离职面谈
export function createAndUpdateTalk(params) {
    return request('/api/dimission/v1/interviews/createOrUpdate', {
        method: 'POST',
        data: params
    });
}

// 获取离职面谈详情
export function getDimissionTalkDetail(processInstanceId) {
    return request(`/api/dimission/v1/interviews/instance/${processInstanceId}`, {
        method: 'GET'
    });
}

// 取消离职面谈
export function cancelDimissionTalk(data) {
    return request('/api/dimission/v1/interviews/cancel', {
        method: 'POST',
        data
    });
}

// 获取离职详情
export function getDimissionDetail(processInstanceId) {
    return request(`/api/dimission/v1/order/detail/${processInstanceId}`, {
        method: 'GET'
    });
}
